import pandas as pd
import sys
sys.path.append('..')
import config
import seaborn as sns
import matplotlib.pyplot as plt


def draw_heatmap(config, _, df):
    corr = df.drop(["Unnamed: 0"], axis=1).corr()
    plt.figure(figsize=(12, 12))
    plt.title(_.split('/')[-1] + '_heatmap')
    sns.heatmap(corr)

    plt.savefig(config['data_path']['heatmap'].format(_.split('/')[-1]) + '.png')
    plt.show()


def main(config):
    for _ in config['repository_list']:
        f_path = config['data_path']['final'].format(_.split('/')[-1]) + '.csv'
        df = pd.read_csv(f_path)
        draw_heatmap(config, _, df)


if __name__ == '__main__':
    _config = config.get_config()
    main(_config)
